# -*- coding: utf-8 -*-
from libs import plugin_base

@plugin_base.ModuleFunc("/test.do",
                        ApiOperation = {
                            "Name": "测试功能1",
                            "Description": "测试功能1描述",
                            "NeedAuth": False
                        },
                        ApiParameter = {
                            "Description": "用户信息",
                            "Properties": {
                                "UserID": { "DataType": "string", "Description": "用户ID", "Required": True },
                                "UserName": { "DataType": "string", "Description": "用户姓名", "Required": True },
                                "UserStatus": { "DataType": "string", "Description": "用户状态", "Enum": ["Stop","Start"], "Required": True },
                                "UserDept": {
                                    "DataType": "object", "Description": "组织机构", "Required": True,
                                    "Properties": {
                                        "DeptID": { "DataType": "string", "Description": "部门ID", "Required": True },
                                        "DeptName": { "DataType": "string", "Description": "部门名称", "Required": True }
                                    }
                                },
                                "UserCorps": {
                                    "DataType": "array", "Description": "用户公司", "Required": True,
                                    "Items": {
                                        "DataType": "string"
                                    }
                                },
                                "UserRoles": {
                                    "DataType": "array", "Description": "用户角色", "Required": True,
                                    "Items": {
                                        "DataType": "object",
                                        "Properties": {
                                            "RoleID": {"DataType": "string", "Description": "角色ID", "Required": True},
                                            "RoleName": {"DataType": "string", "Description": "角色名称", "Required": True}
                                        }
                                    }
                                }
                            }
                        },
                        ApiResponse = {
                            "Description": "部门信息",
                            "DataType": "string",
                            "Properties": {
                                "DeptID": {"DataType": "string", "Description": "部门ID", "Required": True},
                                "DeptName": {"DataType": "string", "Description": "部门名称", "Required": True}
                            }
                        }
                        )
def PluginModuleFunc1(inParameter):
    isExist = inParameter.HasAttr("UserName")
    return inParameter.UserName




